<div class="wrapper-1">
  <div class="wrapper-2">
    <div class="wrapper-3">
      <div class="left-bg">
        <div class="right-bg">
          <div id="middle">
            <div id="middle-expand">
              <div id="main">
                <div id="main-shift">
                  <div class="contentleft-bg">
                    <div class="contentright-bg">
                      <div id="mainmiddle">
                        <div id="mainmiddle-expand">
                          <div id="content">
                            <div id="content-shift">
                              <div id="breadcrumbs"> <span class="breadcrumbs"> <a href="/">Home</a><a href="<?php echo base_url(); ?>tourist-trains-to-sapa.html">Sapa Tourist Trains</a><span class="current"><?php echo $curtrain['train_name']; ?></span></span> </div>
                              <div id="component" class="floatbox">
                                <div class="joomla columnwidth-310">
                                  <script type="text/javascript">
								  $(document).ready(function(){
									  $(document).on("click",".radprice",function(){
										  $trainame = $("#trainname").val();
										  $type = $(this).attr("datatype");
										  $id  = $(this).attr("dataid");
										  $from = $(this).attr("datafrom"); 
										  $to = $(this).attr("datato");
										  $dastart = $(this).attr("datastart");
										  $daend = $(this).attr("dataend");
										  if($(".radprice"+$id).is(":checked")){
											  $obj = $("input[class='radprice"+$id+"']:checked");
											  $val = $obj.val();
											  $name = $obj.attr("dataname");
											  jQuery.post("<?php echo base_url()."home/cart/add"; ?>",{id:$id,type:$type,val:$val,name:$name,trainame:$trainame,from:$from,to:$to,start:$dastart,end:$daend},function(result){
											  	 $("#cart").load("<?php echo base_url(); ?>home/cart");
										  	  });
										  }else{
											  alert("Please select a cabin!");
											  return false;
										  }
									  });
								  });
                                  </script>
                                  <div class="article">
                                    <h2><?php echo $curtrain['train_name']; ?></h2>
                                    <h3>Train from Hanoi to Sapa by <?php echo $curtrain['train_name']; ?></h3>
                                    <input type="hidden" id="trainname" value="<?php echo $curtrain['train_name']; ?>" />
                                    <table class="trains" style="width: 715px;">
                                      <thead>
                                        <tr>
                                          <th scope="col">Departs</th>
                                          <th scope="col">Arrives</th>
                                          <th scope="col">Train No</th>
                                          <th scope="col">Hard Berth(6)</th>
                                          <th scope="col">Soft Berth(4)</th>
                                          <th scope="col">VIP Berth(2)</th>
                                          <th scope="col"></th>
                                        </tr>
                                      </thead>
                                      <tbody>
                                        <?php if(isset($liststart) && $liststart != NULL){ ?>
										<?php foreach($liststart as $tickstart){ ?>
                                        <tr>
                                          <td><b>Ha Noi - </b><?php echo $tickstart['tickdeparts']; ?></td>
                                          <td><b>Sapa - </b><?php echo $tickstart['tickarrives']; ?></td>
                                          <td><a title="" target="_blank">SP3</a></td>
                                          <td><?php if($tickstart['hardberth'] != 0){ echo "<span><input class='radprice".$tickstart['tickid']."' dataname='Hard Berth' value='".$tickstart['hardberth']."' name='rooms".$tickstart['tickid']."' type='radio' />&nbsp;$".$tickstart['hardberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><?php if($tickstart['softberth'] != 0){ echo "<span><input class='radprice".$tickstart['tickid']."' dataname='Soft berth' dataid='".$tickstart['tickid']."' value='".$tickstart['softberth']."' name='rooms".$tickstart['tickid']."' type='radio' />&nbsp;$".$tickstart['softberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><?php if($tickstart['vipberth'] != 0){ echo "<span><input class='radprice".$tickstart['tickid']."' dataname='Vip Berth' dataid='".$tickstart['tickid']."' value='".$tickstart['vipberth']."' name='rooms".$tickstart['tickid']."' type='radio' />&nbsp;$".$tickstart['vipberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                          <td><span class="booking"><a href="javascript:void(0)" <?php echo "datatype='1' datafrom='Hanoi' datato='Sapa' datastart='".$tickstart['tickdeparts']."' dataend='".$tickstart['tickarrives']."' dataid='".$tickstart['tickid']."'"; ?> title="Book" class="radprice">Book</a></span></td>
                                        </tr>
                                        <?php } }else{ ?>
                                        <tr>
                                          <th colspan="8" style="background:none;color:#000">No tickets available</th>
                                        </tr>
                                        <?php } ?>
                                      </tbody>
                                    </table>
                                    <br>
                                    <div>
                                      <h3>Train return from Sapa to Hanoi by <?php echo $curtrain['train_name']; ?></h3>
                                      <table class="trains" style="width: 715px;">
                                        <thead>
                                          <tr>
                                            <th scope="col">Departs</th>
                                            <th scope="col">Arrives</th>
                                            <th scope="col">Train No</th>
                                            <th scope="col">Hard Berth(6)</th>
                                            <th scope="col">Soft Berth(4)</th>
                                            <th scope="col">VIP Berth(2)</th>
                                            <th scope="col"></th>
                                          </tr>
                                        </thead>
                                        <tbody>
                                          <?php if(isset($listend) && $listend != NULL){ ?>
											<?php foreach($listend as $tickend){ ?>
                                            <tr>
                                              <td><b>Sapa - </b><?php echo $tickend['tickdeparts']; ?></td>
                                              <td><b>Ha Noi - </b><?php echo $tickend['tickarrives']; ?></td>
                                              <td><a title="" target="_blank">SP3</a></td>
                                              <td><?php if($tickend['hardberth'] != 0){ echo "<span><input class='radprice".$tickend['tickid']."' datatype='2' datafrom='Sapa' datato='Hanoi' dataname='Hard Berth' dataid='".$tickend['tickid']."' value='".$tickend['hardberth']."' name='rooms".$tickend['tickid']."' type='radio' />&nbsp;$".$tickend['hardberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                              <td><?php if($tickend['softberth'] != 0){ echo "<span><input class='radprice".$tickend['tickid']."' datatype='2' datafrom='Sapa' datato='Hanoi' dataname='Soft berth' dataid='".$tickend['tickid']."' value='".$tickend['softberth']."' name='rooms".$tickend['tickid']."' type='radio' />&nbsp;$".$tickend['softberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                              <td><?php if($tickend['vipberth'] != 0){ echo "<span><input class='radprice".$tickend['tickid']."' datatype='2' datafrom='Sapa' datato='Hanoi' dataname='Vip Berth' dataid='".$tickend['tickid']."' value='".$tickend['vipberth']."' name='rooms".$tickend['tickid']."' type='radio' />&nbsp;$".$tickend['vipberth']."</span>"; }else{ echo "<span>N/A</span>";} ?></td>
                                              <td><span class="booking"><a href="javascript:void(0)" <?php echo "datatype='2' datafrom='Sapa' datato='Hanoi' datastart='".$tickend['tickdeparts']."' dataend='".$tickend['tickarrives']."' dataid='".$tickend['tickid']."'"; ?> title="Book" class="radprice">Book</a></span></td>
                                            </tr>
                                            <?php } }else{ ?>
                                            <tr>
                                              <th colspan="8" style="background:none;color:#000">No tickets available</th>
                                            </tr>
                                            <?php } ?>
                                        </tbody>
                                      </table>
                                    </div>
                                    <div class="traininfo">
                                    <?php echo $curtrain['train_overview']; ?>
                                    </div> 
                                    <div style="text-align:left;">
                                      <div><b>All of the train from Hanoi to Sapa:</b></div>
                                      <?php if(isset($related)){ ?>
                                      <?php foreach($related as $rela){ ?>
                                      <div>
                                      	<a href="<?php echo base_url()."sapa-tourist/".$rela['train_rewrite']; ?>.html" style="color:rgb(255,102,0);">&gt;&gt; <?php echo $rela['train_name']; ?></a>
                                      </div>
                                      <?php } } ?>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                          <!-- content end --> 
                          
                        </div>
                      </div>
                      <!-- mainmiddle end --> 
                    </div>
                  </div>
                </div>
              </div>
              <div id="right" style="min-height: 955px; ">
                <?php $this->load->view("public/tickets"); ?>
                <?php $this->load->view("public/advs"); ?>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="wrapper-b1">
  <div class="wrapper-b2">
    <div class="wrapper-b3"></div>
  </div>
</div>
</div>
</div>
</div>